export function applyMontyHall(predictions, excludedNumbers) {
  // Filter out excluded numbers
  const remaining = predictions.filter(p => !excludedNumbers.includes(p.number));
  
  if (remaining.length === 0) return predictions;
  
  // Redistribute probabilities
  const totalExcludedProb = predictions
    .filter(p => excludedNumbers.includes(p.number))
    .reduce((sum, p) => sum + p.probability, 0);
  
  const redistributionFactor = totalExcludedProb / remaining.reduce((sum, p) => sum + p.probability, 0);
  
  // Create new predictions with adjusted probabilities
  const adjustedPredictions = predictions.map(p => {
    if (excludedNumbers.includes(p.number)) {
      return { ...p, probability: 0, percentage: '0.00%' };
    } else {
      const newProb = p.probability * (1 + redistributionFactor);
      return { 
        ...p, 
        probability: newProb, 
        percentage: (newProb * 100).toFixed(2) + '%' 
      };
    }
  });
  
  // Sort by new probability
  return adjustedPredictions.sort((a, b) => b.probability - a.probability);
}